package edu.sctu.yueding.activitys;

import android.content.Context;
import android.graphics.drawable.BitmapDrawable;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ListView;
import android.widget.PopupWindow;

/**
 * Created by 鑫爷您慢点 on 2016/9/13.
 */
public class SelectSexPopupWindow extends PopupWindow {
    private View view;

    private Context context;

    public SelectSexPopupWindow(Context context, int mWidth, int mHeight, View view) {
        this.view = view;
        this.context = context;

        setContentView(view);
        setWidth(mWidth);
        setHeight(mHeight);

        setFocusable(true);//设置可触摸
        setTouchable(true);//
        setOutsideTouchable(true);//设置外部可触摸

        setBackgroundDrawable(new BitmapDrawable());//点击外面消失

        setTouchInterceptor(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {//判断动作是点击在外部
                    dismiss();//消失
                    return true;
                }
                return false;
            }
        });

        initView(context);
    }

    private void initView(Context context) {

    }

}
